var a = require("../../../@babel/runtime/helpers/defineProperty"), t = require("../../../@babel/runtime/helpers/objectWithoutProperties"), e = [ "list" ], i = getApp();

Page({
    data: {
        releaseInfo: {},
        dataList: [],
        titleArr: [ "固定释放记录", "加速释放记录" ]
    },
    onLoad: function(a) {
        var t = this;
        this.activeName = 0, this.data.dataList = [], this.data.titleArr.forEach(function(a, e) {
            t.data.dataList.push({
                isLoadMore: !0,
                page: 1,
                total_page: 0,
                list: []
            });
        }), this.getData();
    },
    getData: function(s) {
        var o = this;
        s && (this.activeName = s.detail.name);
        var d = i.getNetAddresss("plugin.love-release.frontend.controllers.index.index");
        i._postNetWork({
            url: d,
            data: {
                release_type: this.activeName + 1
            },
            success: function(i) {
                wx.hideLoading();
                var s = i.data;
                if (1 == s.result) {
                    var d = s.data, n = d.list, r = t(d, e);
                    wx.setNavigationBarTitle({
                        title: "待释放".concat(r.diy_name)
                    }), o.isLoadMore = !0, o.data.dataList[o.activeName].page = 1, o.data.dataList[o.activeName].isLoadMore = !0, 
                    o.data.dataList[o.activeName].total_page = n.last_page, o.setData(a({
                        releaseInfo: r
                    }, "dataList[" + o.activeName + "].list", n.data));
                } else wx.showToast({
                    title: s.msg,
                    duration: 1e3,
                    icon: "none"
                });
            },
            fail: function(a) {
                wx.hideLoading();
            }
        });
    },
    _getMoreData: function() {
        var t = this;
        if (this.data.dataList[this.activeName].isLoadMore = !1, !(this.data.dataList[this.activeName].page >= this.data.dataList[this.activeName].total_page)) {
            this.data.dataList[this.activeName].page = this.data.dataList[this.activeName].page + 1;
            var e = i.getNetAddresss("plugin.love-release.frontend.controllers.index.index");
            e += "&page=" + this.data.dataList[this.activeName].page, i._getNetWork({
                url: e,
                data: {
                    release_type: this.activeName + 1
                },
                success: function(e) {
                    var i = e.data;
                    if (1 == i.result) {
                        var s = i.data.list;
                        t.data.dataList[t.activeName].isLoadMore = !0, t.setData(a({}, "dataList[" + t.activeName + "].list", t.data.dataList[t.activeName].list.concat(s.data)));
                    } else t.data.dataList[t.activeName].isLoadMore = !1, t.setData(a({}, "dataList[" + t.activeName + "].page", t.data.dataList[t.activeName].page - 1));
                },
                fail: function(a) {
                    console.log(a);
                }
            });
        }
    },
    onReady: function() {},
    onShow: function() {},
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {},
    onReachBottom: function() {
        this.data.dataList[this.activeName].isLoadMore ? this._getMoreData() : console.log("没有更多数据");
    },
    onShareAppMessage: function() {}
});